import request from '@/utils/request'

// 登录
export const login = (data) => {
  return request.post('/api/user-service/user/login', data)
}

// 获取用户信息
export const getUserInfo = (id) => {
  return request.get(`/api/user-service/user/${id}`)
}

// 获取合作商数量
export const getPartnerCount = () => {
  return request.get('/api/user-service/partner/count')
}

// 搜索用户
export const searchUser = (params) => {
  return request.get(`/api/user-service/user/search`, {
    params
  })
}

// 搜索合作商
export const searchPartner = (params) => {
  return request.get('/api/user-service/partner/search', {
    params
  })
}

// 新增合作商
export const addPartner = (data) => {
  return request.post('/api/user-service/partner', data)
}

// 重置合作商密码
export const resetPwd = (id) => {
  return request.put(`/api/user-service/partner/resetPwd/${id}`)
}

// 更新合作商信息
export const updatePartnerInfo = (data) => {
  return request.put(`/api/user-service/partner/${data.id}`, data)
}

// 删除合作商
export const delPartner = (id) => {
  return request.delete(`/api/user-service/partner/${id}`)
}

// 根据设备获取运营人员列表
export const getOperatorList = (innerCode) => {
  return request.get(`/api/user-service/user/operatorList/${innerCode}`)
}

// 搜索人员列表
export const searchUserList = (params) => {
  return request.get('/api/user-service/user/search', { params })
}

// 获取角色列表
export const getRoleList = () => request.get('/api/user-service/role')

// 新增人员
export const addUser = (data) => request.post('/api/user-service/user', data)

// 修改人员
export const updateUser = (data, id) => request.put(`/api/user-service/user/${id}`, data)

// 删除人员
export const deleteUser = (id) => request.delete(`/api/user-service/user/${id}`)

// 获取人员工作量列表
export const getUserWork = (params) => request.get('/api/user-service/user/searchUserWork', { params })

// 获取用户工作量
export const getUserWorkInfo = (params) => request.get('/api/task-service/task/userWork', { params })
